[@plaintext.layout title="QuickView"]
<#-- This directive works in the same way as the macro directive, except that return directive must 
have a parameter that specifies the return value of the method, and that attempts to write to the 
output will be ignored.
-->

h1. Simple function
[#function avg x y]
  [#return (x + y) / 2]
[/#function]
${avg(10, 20)}  

h1. Varargs parameters function
[#function avg nums...]
  [#local sum = 0]
  [#list nums as num]
    [#local sum = sum + num]
  [/#list]
  [#if nums?size != 0]
    [#return sum / nums?size]
  [/#if]
[/#function]
${avg(10, 20)}
${avg(10, 20, 30, 40)}
${avg()!"N/A"}  
[/@plaintext.layout]
